package com.lc.headline.service.impl;

import com.lc.headline.dao.NewsUserDao;
import com.lc.headline.dao.impl.NewsUserDaoImpl;
import com.lc.headline.pojo.NewsUser;
import com.lc.headline.service.NewsUserService;
import com.lc.headline.util.MD5Util;

/**
 * @author liuchun
 */
public class NewsUserServiceImpl implements NewsUserService {
    private NewsUserDao newsUserDao  = new NewsUserDaoImpl();
    @Override
    public NewsUser findUserByName(String username) {
        return newsUserDao.findUserByName(username);
    }

    @Override
    public NewsUser findUserByUid(Integer uid) {
        return newsUserDao.findUserByUid(uid);
    }

    @Override
    public Integer regist(NewsUser newsUser) {
        //进行密码加密
        newsUser.setUserPwd(MD5Util.encrypt(newsUser.getUserPwd()));
        return newsUserDao.registUser(newsUser);
    }
}
